package br.com.datasun.biblioteca.ui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Color;

import images.ImageLoader;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class SobreSistemaUI extends JDialog {

	private final JPanel contentPanel = new JPanel();
	private Dimension tamanhoPanelFoto = new Dimension(80,80);
	private Dimension tamanhoFoto = new Dimension(70,70);
	
	private JLabel jlFoto1 = new JLabel("");
	private JLabel jlFoto2 = new JLabel("");
	private JLabel jlFoto3 = new JLabel("");

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			SobreSistemaUI dialog = new SobreSistemaUI();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public SobreSistemaUI() {
		carregarFotos();
		setBounds(100, 100, 450, 383);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout(0, 0));
		{
			JPanel jpTituloSistema = new JPanel();
			Dimension tamanhoJpTituloSistema = new Dimension(30,50);
			jpTituloSistema.setPreferredSize(tamanhoJpTituloSistema);
			contentPanel.add(jpTituloSistema, BorderLayout.NORTH);
			jpTituloSistema.setLayout(new BorderLayout(0, 0));
			{
				JLabel lblTituloSistema = new JLabel("Sistema Gest\u00E3o de Bibliotecas - Vers\u00E3o 1.0.0.0");
				lblTituloSistema.setForeground(Color.GRAY);
				lblTituloSistema.setFont(new Font("Tahoma", Font.BOLD, 13));
				lblTituloSistema.setHorizontalAlignment(SwingConstants.CENTER);
				jpTituloSistema.add(lblTituloSistema, BorderLayout.CENTER);
			}
		}
		{
			JPanel jpCentro = new JPanel();		
			contentPanel.add(jpCentro, BorderLayout.CENTER);
			GridBagLayout gbl_jpCentro = new GridBagLayout();
			gbl_jpCentro.columnWidths = new int[]{28, 28, 28, 0, 0};
			gbl_jpCentro.rowHeights = new int[]{28, 28, 28, 28, 28, 28, 28, 28, 0, 0};
			gbl_jpCentro.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
			gbl_jpCentro.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
			jpCentro.setLayout(gbl_jpCentro);
			{
				JPanel panel = new JPanel();
				panel.setBackground(Color.WHITE);
				GridBagConstraints gbc_panel = new GridBagConstraints();
				gbc_panel.gridwidth = 3;
				gbc_panel.gridheight = 3;
				gbc_panel.insets = new Insets(0, 0, 5, 5);
				gbc_panel.fill = GridBagConstraints.BOTH;
				gbc_panel.gridx = 0;
				gbc_panel.gridy = 0;
				jpCentro.add(panel, gbc_panel);
				panel.setLayout(new BorderLayout(0, 0));
				{
					JPanel jpFoto1 = new JPanel();
					jpFoto1.setPreferredSize(tamanhoPanelFoto);
					jpFoto1.setBackground(Color.LIGHT_GRAY);
					panel.add(jpFoto1, BorderLayout.CENTER);
					jpFoto1.setLayout(new BorderLayout(8, 8));
					{
						
						jlFoto1.setPreferredSize(tamanhoFoto);
						jlFoto1.setBackground(Color.WHITE);
						jlFoto1.setHorizontalAlignment(SwingConstants.CENTER);
						jpFoto1.add(jlFoto1, BorderLayout.CENTER);
					}
				}
			}
			{
				JLabel lblDouglasFelcioBertachini = new JLabel("Douglas Fel\u00EDcio Bertachini");
				lblDouglasFelcioBertachini.setVerticalAlignment(SwingConstants.BOTTOM);
				lblDouglasFelcioBertachini.setHorizontalAlignment(SwingConstants.LEFT);
				lblDouglasFelcioBertachini.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12));
				GridBagConstraints gbc_lblDouglasFelcioBertachini = new GridBagConstraints();
				gbc_lblDouglasFelcioBertachini.anchor = GridBagConstraints.SOUTHWEST;
				gbc_lblDouglasFelcioBertachini.insets = new Insets(0, 0, 5, 0);
				gbc_lblDouglasFelcioBertachini.gridx = 3;
				gbc_lblDouglasFelcioBertachini.gridy = 1;
				jpCentro.add(lblDouglasFelcioBertachini, gbc_lblDouglasFelcioBertachini);
			}
			{
				JLabel label = new JLabel("douglas@i9fs.com.br");
				label.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 11));
				GridBagConstraints gbc_label = new GridBagConstraints();
				gbc_label.anchor = GridBagConstraints.NORTHWEST;
				gbc_label.insets = new Insets(0, 0, 5, 0);
				gbc_label.gridx = 3;
				gbc_label.gridy = 2;
				jpCentro.add(label, gbc_label);
			}
			{
				JPanel jpFoto2 = new JPanel();
				jpFoto2.setBackground(Color.LIGHT_GRAY);
				GridBagConstraints gbc_jpFoto2 = new GridBagConstraints();
				gbc_jpFoto2.gridheight = 3;
				gbc_jpFoto2.gridwidth = 3;
				gbc_jpFoto2.insets = new Insets(0, 0, 5, 5);
				gbc_jpFoto2.fill = GridBagConstraints.BOTH;
				gbc_jpFoto2.gridx = 0;
				gbc_jpFoto2.gridy = 3;
				jpCentro.add(jpFoto2, gbc_jpFoto2);
				jpFoto2.setLayout(new BorderLayout(0, 0));
				{
					
					jlFoto2.setPreferredSize(new Dimension(70, 70));
					jlFoto2.setHorizontalAlignment(SwingConstants.CENTER);
					jlFoto2.setBackground(Color.WHITE);
					jpFoto2.add(jlFoto2, BorderLayout.CENTER);
				}
			}
			{
				JLabel lblJosGonalvesJnior_1 = new JLabel("Jos\u00E9 Gon\u00E7alves J\u00FAnior");
				lblJosGonalvesJnior_1.setVerticalAlignment(SwingConstants.BOTTOM);
				lblJosGonalvesJnior_1.setHorizontalAlignment(SwingConstants.LEFT);
				lblJosGonalvesJnior_1.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12));
				GridBagConstraints gbc_lblJosGonalvesJnior_1 = new GridBagConstraints();
				gbc_lblJosGonalvesJnior_1.anchor = GridBagConstraints.SOUTHWEST;
				gbc_lblJosGonalvesJnior_1.insets = new Insets(0, 0, 5, 0);
				gbc_lblJosGonalvesJnior_1.gridx = 3;
				gbc_lblJosGonalvesJnior_1.gridy = 4;
				jpCentro.add(lblJosGonalvesJnior_1, gbc_lblJosGonalvesJnior_1);
			}
			{
				JLabel lblJosejrgoncalvesterracombr_1 = new JLabel("josejr.goncalves@terra.com.br");
				lblJosejrgoncalvesterracombr_1.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 11));
				GridBagConstraints gbc_lblJosejrgoncalvesterracombr_1 = new GridBagConstraints();
				gbc_lblJosejrgoncalvesterracombr_1.anchor = GridBagConstraints.NORTHWEST;
				gbc_lblJosejrgoncalvesterracombr_1.insets = new Insets(0, 0, 5, 0);
				gbc_lblJosejrgoncalvesterracombr_1.gridx = 3;
				gbc_lblJosejrgoncalvesterracombr_1.gridy = 5;
				jpCentro.add(lblJosejrgoncalvesterracombr_1, gbc_lblJosejrgoncalvesterracombr_1);
			}
			{
				JPanel jpFoto3 = new JPanel();
				jpFoto3.setPreferredSize(tamanhoPanelFoto);
				jpFoto3.setBackground(Color.LIGHT_GRAY);
				GridBagConstraints gbc_jpFoto3 = new GridBagConstraints();
				gbc_jpFoto3.gridheight = 3;
				gbc_jpFoto3.gridwidth = 3;
				gbc_jpFoto3.insets = new Insets(0, 0, 0, 5);
				gbc_jpFoto3.fill = GridBagConstraints.BOTH;
				gbc_jpFoto3.gridx = 0;
				gbc_jpFoto3.gridy = 6;
				jpCentro.add(jpFoto3, gbc_jpFoto3);
				jpFoto3.setLayout(new BorderLayout(0, 0));
				{
					
					jlFoto3.setPreferredSize(tamanhoFoto);
					jlFoto3.setPreferredSize(new Dimension(70, 70));
					jlFoto3.setHorizontalAlignment(SwingConstants.CENTER);
					jlFoto3.setBackground(Color.WHITE);
					jpFoto3.add(jlFoto3, BorderLayout.CENTER);
				}
			}
			{
				JLabel lblJosGonalvesJnior = new JLabel("Marlon Frankelin Cenerino");
				lblJosGonalvesJnior.setVerticalAlignment(SwingConstants.BOTTOM);
				lblJosGonalvesJnior.setHorizontalAlignment(SwingConstants.LEFT);
				lblJosGonalvesJnior.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12));
				GridBagConstraints gbc_lblJosGonalvesJnior = new GridBagConstraints();
				gbc_lblJosGonalvesJnior.anchor = GridBagConstraints.SOUTHWEST;
				gbc_lblJosGonalvesJnior.insets = new Insets(0, 0, 5, 0);
				gbc_lblJosGonalvesJnior.gridx = 3;
				gbc_lblJosGonalvesJnior.gridy = 7;
				jpCentro.add(lblJosGonalvesJnior, gbc_lblJosGonalvesJnior);
			}
			{
				JLabel lblJosejrgoncalvesterracombr = new JLabel("marlon@i9fs.com.br");
				lblJosejrgoncalvesterracombr.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 11));
				GridBagConstraints gbc_lblJosejrgoncalvesterracombr = new GridBagConstraints();
				gbc_lblJosejrgoncalvesterracombr.anchor = GridBagConstraints.NORTHWEST;
				gbc_lblJosejrgoncalvesterracombr.gridx = 3;
				gbc_lblJosejrgoncalvesterracombr.gridy = 8;
				jpCentro.add(lblJosejrgoncalvesterracombr, gbc_lblJosejrgoncalvesterracombr);
			}
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("OK");
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						fecharTela();
					}
				});
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}			
		}
	}
	
	private void carregarFotos(){
		jlFoto1.setIcon(ImageLoader.createImageIcon("fotoDouglas.png"));
		jlFoto2.setIcon(ImageLoader.createImageIcon("fotoJose.png"));
		jlFoto3.setIcon(ImageLoader.createImageIcon("fotoMarlon.png"));
	}
	
	private void fecharTela(){
		this.dispose();
	}

}
